<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>

    // 参数解析
    /* var str = "wd=&col=id&type=asc&page=1&size=10"
    var list = str.split("&");
    console.log("list", list);

    var data = {};
    for (var i = 0; i < list.length; i++) {
        var item = list[i];  // 'user=zxczxc', 'pwd=123123', 
        var key = item.split("=")[0]; // "user"  "pwd"   将字符串作为对象的键名 => []
        var val = item.split("=")[1]; // 
        console.log(item, key, val);
        data[key] = val;
    }
    console.log(data);*/

    var data = {wd: '', col: 'id', type: 'asc', page: '1', size: '10'}

    // 将数据还原为参数数据队列

    var list = [];
    for(var key in data){
        var val = data[key];
        var subStr = key + "="  + val;
        console.log(subStr);
        list.push(subStr);
    }
    console.log(list);

    data = list.join("&");
    console.log(data);






</script>

</html>